const path = require('path');

module.exports = {
  webpack: (config) => {
    config.output.library = 'PlatformMicroApp';
    config.output.libraryTarget = 'umd';
    config.output.jsonpFunction = `webpackJsonp_PlatformMicroApp`;

    config.resolve.alias = {
      ...config.resolve.alias,
      "@": path.resolve(__dirname, "src")
    };
    return config;
  },

  devServer: function(configFunction) {
    return function(proxy, allowedHost) {
      const config = configFunction(proxy, allowedHost);
      config.disableHostCheck = true;
      config.headers = {
        "Access-Control-Allow-Origin": '*',
      };
      config.historyApiFallback = true;
      config.hot = true;
      return config;
    }
  }
}